from common.base import Dao
from models.oauth import OauthGiteeUser
from models.user import User


class OauthDao(Dao):

    def get(self, **kwargs):
        return self.model.get(**kwargs)

    async def create(self, username, password, openid: str):
        """注册用户 并写入openid"""
        user = await User.create(username=username, password=password)
        return await self.model.create(openid=openid, user=user)
    ...


oauth_dao = OauthDao(OauthGiteeUser)
__all__ = ["oauth_dao"]
